package com.scott.spring.ch02;

import com.scott.spring.ch02.conf.AppConf;
import com.scott.spring.ch02.service.RoleService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author 黄后林
 * @version 1.0
 * @date 2021-12-14 09:40:55
 */
public class Ch02Test {

    public static void main(String[] args) {
        System.out.println("--------容器启动开始--------");
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConf.class);
        System.out.println("--------容器启动结束--------");

        // 在容器中创建Bean 并且取出Bean[Bean=对象]
        RoleService roleService = context.getBean(RoleService.class);
        int sum =roleService.add(10,20);
        System.out.println(sum);

    }
}
